Quantization families
ik_llama.cpp supports several quantization families:Quality ladder
Lower bits per weight (BPW) means a smaller file but more quality loss. Use this as a reference when choosing a quant for your use case:Importance matrix (imatrix)
An imatrix is calibration data generated from a sample text corpus. It guides the quantizer to allocate precision where it matters most, reducing quality loss at every bit level. imatrix is supported for all quant types except bitnet. For quants belowQ6_0, using an imatrix is strongly recommended.
See the imatrix guide for instructions on generating and using one.
How to pick a quant
-
Start from memory constraints. Find the largest quant that fits in your VRAM (or RAM for CPU-only inference). Use
-ngl 999to attempt a full GPU load and lower the layer count if you run out of memory. - Prioritise quality within that constraint. Prefer IQK quants over legacy quants at the same BPW — they provide better quality for the same file size.
-
Use an imatrix. For any quant below
Q6_0, always pass--imatrixwhen quantizing to meaningfully reduce quality loss. -
Consider R4 variants on CPU. IQK
_R4types use row-interleaved packing for better CPU throughput. Pass-rtrat runtime to repack on the fly if you have a non-R4 file.
Further reading
IQK quantization types
State-of-the-art IQK formats: IQ2_K through IQ6_K, R4 variants, MXFP4, and custom quant mixes.
Trellis quantization
IQ1_KT through IQ4_KT: extreme compression using a novel integer trellis.
Importance matrix
Generate and apply an imatrix to improve quality at any bit level.